<template>
  <div>
    <van-row style="background: skyblue">
      <van-col span="6"></van-col>
      <van-col span="18" style="text-align: right"><headers /></van-col>
    </van-row>

    <!-- <van-row> -->
    <van-row>
      <van-col span="4"><left /></van-col>
      <van-col span="4">
        <van-search
          label="组织名称"
          placeholder="请输入搜索关键词"
          style="width: 300px"
        />
        <van-uploader :after-read="upload" multiple accept=".xls"/>导人&emsp;<van-button>导出</van-button>
        <van-row>
          <van-col span="24" >
            <div>
              <el-tree
                :data="data"
                show-checkbox
                node-key="id"
                :default-expanded-keys="[2, 3]"
                :default-checked-keys="[5]"
                :props="defaultProps"
              />
            </div>
          </van-col>
        </van-row>
      </van-col>
    </van-row>

    <!-- </van-row> -->
  </div>
</template>

<script>
import headers from "./headers.vue";
import left from "./left.vue";
import axios from "axios";
export default {
  components: { headers, left },

  data() {
    return {
        data: [],
       defaultProps: {
        children: 'son',
        label: 'name',
      },
    };
  },
  methods: {
      get_data() {
      axios({url:'/dept',method:'get'}).then(res=>{
          console.log(res)
          this.data=res.data.list
      })
    },
    upload(file){
        let formDate=new FormData()
        formDate.append('file',file.file)
        axios({url:'http://localhost:5000/upload',method:"post",data:formDate}).then(res=>{
            console.log(res)
        })
    }
  },
  mounted () {
     this.get_data()
  }
};
</script>

<style>
</style>